using System;

namespace Weazel.Toad.TextEditor.Document
{
	public class HighlighterFactory
	{
		public static Highlighter CreateHighlightingStrategy()
		{
			return (Highlighter)HighlightingManager.Manager.HighlightingDefinitions["Default"];
		}
		
		public static Highlighter CreateHighlightingStrategy(string name)
		{
			Highlighter highlightingStrategy  = HighlightingManager.Manager.FindHighlighter(name);
			
			if (highlightingStrategy == null) {
				return CreateHighlightingStrategy();
			}
			return highlightingStrategy;
		}
		
		public static Highlighter CreateHighlightingStrategyForFile(string fileName)
		{
			Highlighter highlightingStrategy  = HighlightingManager.Manager.FindHighlighterForFile(fileName);
			if (highlightingStrategy == null) {
				return CreateHighlightingStrategy();
			}
			return highlightingStrategy;
		}
	}
}
